<template>
  <div class="app-container flex-col minH">
    <!-- <div class="topline w100p bgwhite ptb20 radius10 pl10 pr20 justify-between">
      <div>
        <el-select v-model="value" placeholder="選擇紅利類型" size="large" style="width: 240px">
          <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
        </el-select>
        <el-select v-model="value" placeholder="選擇加點類型" size="large" style="width: 240px">
          <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
        </el-select>
        <el-select v-model="value" placeholder="選擇扣點類型" size="large" style="width: 240px">
          <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
        </el-select>
        <el-time-picker v-model="value2" placeholder="開始時間" />
        <span class="plr10">-</span>
        <el-time-picker v-model="value2" placeholder="結束時間" />

      </div>
      <div class="noshrink">
        <el-button class="btn2">查詢</el-button>
        <el-button class="btn1">重置</el-button>
      </div>
    </div> -->
    <div class="bgblueg ptb30 radius10 w100p mt15 plr80 justify-between">
      <div class="align-center clr3c4 flex1">
        <div>
          <div class="ft46">{{ topTotalData.charge || 0 }}</div>
          <div>本日目前充值（元）</div>
        </div>
        <div class="ml6p">
          <div class="ft46">{{ topTotalData.cash || 0 }}</div>
          <div>本月提款（元）</div>
        </div>
        <!-- <div class="ml6p">
          <div class="ft46">VIP紅利</div>
          <div>本日目前充值（元）</div>
        </div> -->
        <div class="ml6p">
          <div class="ft46">{{ topTotalData.pay || 0 }}</div>
          <div>充值提款差額（元）</div>
        </div>
      </div>

    </div>
    <div class="mt15 radius10 hidden pb15 flex1 bgwhite  flex-col w100p">
      <div class="flex1 w100p ">
        <el-table :data="tableData" style="width: 100%" cell-class-name="tbcell" header-cell-class-name="hdcell">

          <el-table-column prop="user" label="客戶訊息" width="200">
            <template #default="scope">
              <span @click="showUser(scope.row.user.id)">{{ scope.row.user.phone }}(ID:{{ scope.row.user.id }})</span>

            </template>
          </el-table-column>
          <el-table-column prop="user.name" label="客戶昵稱" />
          <el-table-column prop="charge" label="充值" sortable />
          <el-table-column prop="pay" label="消費" sortable />
          <el-table-column prop="cash" label="提款" sortable align="right" />
        </el-table>
      </div>
      <div class="plr20 mlauto">
        <!-- <div>小計(元): <span class="ft46 clr3c4 ml10">445587</span> </div> -->
      </div>
      <div class="plr20 mlauto mt20">
        <el-pagination v-model:current-page="currentPage" prev-text="上一頁" next-text="下一頁" :default-page-size="15" :small="small" :disabled="disabled" :background="true" layout="prev, pager, next, jumper" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
      </div>
    </div>

  </div>
</template>

<script setup>
import { Search } from '@element-plus/icons-vue'
import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router';
import { dayReport } from '@/api/statement.js'
import { inject } from 'vue';
const showUser = inject('showUser');
onMounted(() => {
  getDayReport()
})
// 当日账变
const topTotalData = ref({})
const getDayReport = () => {
  dayReport({
    page: currentPage.value
  }).then((res) => {
    console.log('当日账变', res)
    tableData.value = res.list.data
    total.value = res.list.total
    topTotalData.value = res.total
  })

}
const dialogTableVisible = ref(false)
const tableData = ref([])
const tableRowClassName = () => {
  return 'tbrow'
}
const currentPage = ref(1)
const total = ref(0)
const handleSizeChange = (val) => {
  console.log(`${val} items per page`)
}
const handleCurrentChange = (val) => {
  console.log(`current page: ${val}`)
  getDayReport()
}
const router = useRouter()
const toAdd = () => {
  console.log(router)
  router.push({ path: 'addNotice' })
}
const edit = (type) => {
  router.push({ path: 'signEdit' })
}
</script>

<style lang="scss" scoped>
.search {
  overflow: hidden;
  border-radius: 10px !important;
  padding: 5px 0px;
}
</style>
<style></style>
 